import { ApiProperty } from '@nestjs/swagger';
import { IsInt, Min, Max } from 'class-validator';
import { Type } from 'class-transformer';

/**
 * DTO for batch audit code generation request
 */
export class BatchAuditCodeGenerationRequestDto {
  @ApiProperty({
    description: '生成审核码的数量 (1-100)',
    example: 10,
    minimum: 1,
    maximum: 100,
    type: Number,
  })
  @IsInt({ message: 'Count must be an integer' })
  @Min(1, { message: 'Count must be at least 1' })
  @Max(100, { message: 'Count cannot exceed 100' })
  @Type(() => Number) // Ensure input is converted to number
  count: number;
}

/**
 * DTO for batch audit code generation response
 */
export class BatchAuditCodeGenerationResponseDto {
  @ApiProperty({
    description: '生成的审核码列表',
    type: 'array',
    items: {
      type: 'object',
      properties: {
        auditNumber: { type: 'string', example: 'A-12345678' },
        verifyCode: { type: 'string', example: 'V-87654321' },
      },
    },
  })
  codes: Array<{ auditNumber: string; verifyCode: string }>;
}
